package com.aries.common.core.page;

import com.aries.common.enums.http.HttpEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * 表格分页数据对象
 *
 * @author aries
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("分页响应对象")
public class TableDataInfo<T> implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 总记录数
     */
    @ApiModelProperty("总记录数")
    private long total;

    /**
     * 当前页数
     */
    @ApiModelProperty("当前页数")
    private long current;

    /**
     * 每页数量
     */
    @ApiModelProperty("每页数量")
    private long size;

    /**
     * 列表数据
     */
    @ApiModelProperty("列表数据")
    private List<T> rows;

    /**
     * 消息状态码
     */
    @ApiModelProperty("消息状态码")
    private int code;

    /**
     * 消息内容
     */
    @ApiModelProperty("消息内容")
    private String msg;

    /**
     * 构造方法根据 HttpEnums httpEnums进行构造
     *
     * @param httpEnums: http状态枚举
     * @author: 405
     * @since: 2022/2/18
     * @return: null
     */
    public TableDataInfo(HttpEnums httpEnums) {
        this.code = httpEnums.getCode();
        this.msg = httpEnums.getMsg();
    }



}
